package com.learning.xml;

import java.util.ArrayList;
import java.util.List;

public class TestList {
	public static void main(String[] args) {
		List<Person> list = new ArrayList<Person>();
		Person person = new Person("Tom", "male", 14);
		list.add(person);
		person.setName("Judy");
		list.add(person);
		person.setSex("female");
		list.add(person);
		for (Person p : list) {
			System.out.println(p);
		}
	}

}

class Person {
	private String name;
	private String sex;
	private int age;

	public Person(String name, String sex, int age) {
		super();
		this.name = name;
		this.sex = sex;
		this.age = age;
	}

	@Override
	public String toString() {
		return "Person [name=" + name + ", sex=" + sex + ", age=" + age + "]";
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

}